package com.kotlin.flong.coroutines

import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import kotlin.system.measureTimeMillis

/**
 * @Author:liangjl
 * @Date: 2020/7/7-19:35
 * @Eamil:jilongliang@sina.com
 * @Description:
 * 挂起函数的组合
 * 1、
 */
fun main() = runBlocking {

    var measure = measureTimeMillis {
        var value1 = intValue1()
        var value2 = intValue2()
        println("$value1+$value2=${value1 + value2}")
    }

    println("总耗时：$measure")
}

private suspend fun intValue1(): Int {
    delay(2000)
    return 15
}

private suspend fun intValue2(): Int {
    delay(3000)
    return 20
}
